package com.example.mobile2021606163crw0323;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

import android.app.Notification;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        TextView textView = (TextView) findViewById(R.id.TV);
        EditText User = (EditText) findViewById(R.id.User);
        EditText password = (EditText) findViewById(R.id.password);
        EditText newpassword = (EditText) findViewById(R.id.newpassword);
        EditText passwordagain = (EditText) findViewById(R.id.passwordagain);
        Button btn = (Button) findViewById(R.id.btn);
        Button btn2 = (Button) findViewById(R.id.btn2);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                switch (v.getId()){
                    case R.id.btn:
                        if (User.getText().toString().equals("leo")&
                                password.getText().toString().equals("123456"))
                        new AlertDialog.Builder(MainActivity.this)
                        .setTitle("登录信息")
                        .setMessage("密码修改成功")
                        .setPositiveButton("确定",null)
                        .create()
                        .show();
                    break;
                    case R.id.btn2:
                        Intent intent = new Intent(MainActivity.this,NewActivity.class);
                        startActivity(intent);
                        break;
                }
            }
        });
    }

    public void xiugai(View view) {
        Log.e("dianji", "xiugai" );
    }
}